package com.fqgj.sentry.controller.rm;

import com.fqgj.sentry.biz.rm.ScoreModelBusiness;
import com.fqgj.sentry.biz.rm.vo.ScoreComboVo;
import com.fqgj.sentry.biz.rm.vo.ScoreModelCharVo;
import com.fqgj.sentry.biz.rm.vo.ScoreModelTableVo;
import com.fqgj.sentry.common.annotations.ParamsValidate;
import com.fqgj.sentry.common.cache.RequestLocalInfo;
import com.fqgj.sentry.common.response.ApiOutput;
import com.fqgj.sentry.controller.rm.request.QueryComboRequest;
import com.fqgj.sentry.controller.rm.request.ScoreQueryTermsRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by ykpbean kangping.ying@yuntu-inc.com
 *
 * @description
 * @create 2017-10-16 下午2:50
 */

@RestController
@RequestMapping(value = "/risk/score")
public class ScoreModelController {
    @Autowired
    private ScoreModelBusiness scoreModelBusiness;


    @ParamsValidate
    @RequestMapping(value = "/table", method = RequestMethod.POST)
    public ApiOutput findScoreModelTable(@RequestBody ScoreQueryTermsRequest termsRequest) {

        List<ScoreModelTableVo> scoreModelTableVos = scoreModelBusiness.getScoreModelTable(termsRequest);
        return new ApiOutput<>(scoreModelTableVos);
    }

    @ParamsValidate
    @RequestMapping(value = "/char", method = RequestMethod.POST)
    public ApiOutput findScoreModelChar(@RequestBody ScoreQueryTermsRequest termsRequest) {
        ScoreModelCharVo scoreModelCharVo = scoreModelBusiness.getOverdueStatisticChart(termsRequest);
        return new ApiOutput<>(scoreModelCharVo);
    }

    @ParamsValidate
    @RequestMapping(value = "/combo", method = RequestMethod.POST)
    public ApiOutput findScoreCombo(@RequestBody QueryComboRequest termsRequest) {
        List<ScoreComboVo> scoreComboVoList = scoreModelBusiness.getScoreCombo(RequestLocalInfo.getCurrentAppCode(), RequestLocalInfo.getCurrentMerchantId(),
                termsRequest);
        return new ApiOutput<>(scoreComboVoList);
    }


}
